
function mock(app, url, data) {
    app.get(url, (request, response) => {
        response.json(data)
    })
}

const home = require('./src/mock/bookHome')
const shelf = require('./src/mock/bookShelf')
const list = require('./src/mock/bookCategoryList')
const flatList = require('./src/mock/bookFlatList')
module.exports = {
    publicPath: process.env.NODE_ENV === 'production'
        ? './'
        : '/',
    devServer: {
        before(app) {
            console.log(123123)
            mock(app, '/book/home', home)
            mock(app, '/book/shelf', shelf)
            mock(app, '/book/list', list)
            mock(app, '/book/flat-list', flatList)
        }
    }
}
